import request from '@/utils/request'

// 公告相关接口
export function getAnnouncementPage(params) {
  return request({
    url: '/announcements/page',
    method: 'get',
    params
  })
}

export function getAnnouncementDetail(id) {
  return request({
    url: `/announcements/${id}`,
    method: 'get'
  })
}

export function createAnnouncement(data) {
  return request({
    url: '/announcements',
    method: 'post',
    data
  })
}

export function updateAnnouncement(data) {
  return request({
    url: '/announcements',
    method: 'put',
    data
  })
}

export function deleteAnnouncement(id) {
  return request({
    url: `/announcements/${id}`,
    method: 'delete'
  })
}

export function publishAnnouncement(id) {
  return request({
    url: `/announcements/${id}/publish`,
    method: 'post'
  })
}

export function cancelAnnouncement(id) {
  return request({
    url: `/announcements/${id}/cancel`,
    method: 'post'
  })
}

export function topAnnouncement(id, isTop) {
  return request({
    url: `/announcements/${id}/top`,
    method: 'post',
    params: { isTop }
  })
}

export function getUserAnnouncements() {
  return request({
    url: '/announcements/user',
    method: 'get'
  })
}

export function readAnnouncement(id) {
  return request({
    url: `/announcements/${id}/read`,
    method: 'post'
  })
}

export function getAnnouncementStats() {
  return request({
    url: '/announcements/stats',
    method: 'get'
  })
} 